<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Chapter 1. The Type Traits Introspection Library</title>
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="Chapter 1. The Type Traits Introspection Library">
<link rel="next" href="the_type_traits_introspection_library/tti_reason.html" title="Why the TTI Library ?">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
<td align="center"><a href="../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav"><a accesskey="n" href="the_type_traits_introspection_library/tti_reason.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a></div>
<div class="chapter">
<div class="titlepage"><div>
<div><h2 class="title">
<a name="tti"></a>Chapter 1. The Type Traits Introspection Library</h2></div>
<div><div class="author"><h3 class="author">
<span class="firstname">Edward</span> <span class="surname">Diener</span>
</h3></div></div>
<div><p class="copyright">Copyright © 2011-2013 Tropic Software
      East Inc</p></div>
<div><div class="legalnotice">
<a name="tti.legal"></a><p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div></div>
</div></div>
<div class="toc">
<p><b>Table of Contents</b></p>
<dl class="toc">
<dt><span class="section"><a href="index.html#the_type_traits_introspection_library.tti_intro">Introduction</a></span></dt>
<dd><dl><dt><span class="section"><a href="index.html#the_type_traits_introspection_library.tti_intro.tti_headers">Header
      Files</a></span></dt></dl></dd>
<dt><span class="section"><a href="the_type_traits_introspection_library/tti_reason.html">Why the
    TTI Library ?</a></span></dt>
<dt><span class="section"><a href="the_type_traits_introspection_library/tti_terminology.html">Terminology</a></span></dt>
<dt><span class="section"><a href="the_type_traits_introspection_library/tti_functionality.html">General
    Functionality</a></span></dt>
<dd><dl><dt><span class="section"><a href="the_type_traits_introspection_library/tti_functionality.html#the_type_traits_introspection_library.tti_functionality.tti_functionality_nm_gen">Macro
      metafunction name generation considerations</a></span></dt></dl></dd>
<dt><span class="section"><a href="the_type_traits_introspection_library/tti_detail.html">Macro
    Metafunctions</a></span></dt>
<dt><span class="section"><a href="the_type_traits_introspection_library/tti_detail_has_type.html">Introspecting
    an inner type</a></span></dt>
<dd><dl><dt><span class="section"><a href="the_type_traits_introspection_library/tti_detail_has_type.html#the_type_traits_introspection_library.tti_detail_has_type.tti_detail_has_specific_type">Introspecting
      a specific user-defined type</a></span></dt></dl></dd>
<dt><span class="section"><a href="the_type_traits_introspection_library/tti_detail_has_template.html">Introspecting
    an inner class template</a></span></dt>
<dd><dl>
<dt><span class="section"><a href="the_type_traits_introspection_library/tti_detail_has_template.html#the_type_traits_introspection_library.tti_detail_has_template.tti_detail_has_template_macro">Using
      the BOOST_TTI_HAS_TEMPLATE macro</a></span></dt>
<dt><span class="section"><a href="the_type_traits_introspection_library/tti_detail_has_template/tti_detail_has_template_metafunction.html">Using
      the has_template_(xxx) metafunction</a></span></dt>
</dl></dd>
<dt><span class="section"><a href="the_type_traits_introspection_library/tti_function_templates.html">Introspecting
    function templates technique</a></span></dt>
<dt><span class="section"><a href="the_type_traits_introspection_library/tti_detail_has_member_data.html">Introspecting
    member data</a></span></dt>
<dt><span class="section"><a href="the_type_traits_introspection_library/tti_detail_has_member_function.html">Introspecting
    member function</a></span></dt>
<dt><span class="section"><a href="the_type_traits_introspection_library/tti_detail_has_member_function_template.html">Introspecting
    member function template</a></span></dt>
<dt><span class="section"><a href="the_type_traits_introspection_library/tti_detail_has_static_member_data.html">Introspecting
    static member data</a></span></dt>
<dt><span class="section"><a href="the_type_traits_introspection_library/tti_detail_has_static_member_function.html">Introspecting
    static member function</a></span></dt>
<dt><span class="section"><a href="the_type_traits_introspection_library/tti_detail_has_static_member_function_template.html">Introspecting
    static member function template</a></span></dt>
<dt><span class="section"><a href="the_type_traits_introspection_library/tti_detail_has_data.html">Introspecting
    data</a></span></dt>
<dt><span class="section"><a href="the_type_traits_introspection_library/tti_detail_has_function.html">Introspecting
    function</a></span></dt>
<dt><span class="section"><a href="the_type_traits_introspection_library/tti_detail_has_function_template.html">Introspecting
    function template</a></span></dt>
<dt><span class="section"><a href="the_type_traits_introspection_library/tti_nested_type.html">Nested
    Types</a></span></dt>
<dt><span class="section"><a href="the_type_traits_introspection_library/tti_func_sig.html">Nested
    Types and Function Signatures</a></span></dt>
<dt><span class="section"><a href="the_type_traits_introspection_library/tti_enclosing_type.html">Enclosing
    Type</a></span></dt>
<dt><span class="section"><a href="the_type_traits_introspection_library/tti_usingMM.html">An example
    using the macro metafunctions</a></span></dt>
<dt><span class="section"><a href="reference.html">Reference</a></span></dt>
<dd><dl>
<dt><span class="section"><a href="reference.html#header.boost.tti.gen.has_class_gen_hpp">Header &lt;boost/tti/gen/has_class_gen.hpp&gt;</a></span></dt>
<dd><dl></dl></dd>
<dt><span class="section"><a href="header/boost/tti/gen/has_data_gen_hpp.html">Header &lt;boost/tti/gen/has_data_gen.hpp&gt;</a></span></dt>
<dd><dl></dl></dd>
<dt><span class="section"><a href="header/boost/tti/gen/has_enum_gen_hpp.html">Header &lt;boost/tti/gen/has_enum_gen.hpp&gt;</a></span></dt>
<dd><dl></dl></dd>
<dt><span class="section"><a href="header/boost/tti/gen/has_function_gen_hpp.html">Header &lt;boost/tti/gen/has_function_gen.hpp&gt;</a></span></dt>
<dd><dl></dl></dd>
<dt><span class="section"><a href="header/boost/tti/gen/has_function_template_gen_hpp.html">Header &lt;boost/tti/gen/has_function_template_gen.hpp&gt;</a></span></dt>
<dd><dl></dl></dd>
<dt><span class="section"><a href="header/boost/tti/gen/has_member_data_gen_hpp.html">Header &lt;boost/tti/gen/has_member_data_gen.hpp&gt;</a></span></dt>
<dd><dl></dl></dd>
<dt><span class="section"><a href="header/boost/tti/gen/has_member_function_gen_hpp.html">Header &lt;boost/tti/gen/has_member_function_gen.hpp&gt;</a></span></dt>
<dd><dl></dl></dd>
<dt><span class="section"><a href="header/boost/tti/gen/has_member_function_template_gen_hpp.html">Header &lt;boost/tti/gen/has_member_function_template_gen.hpp&gt;</a></span></dt>
<dd><dl></dl></dd>
<dt><span class="section"><a href="header/boost/tti/gen/has_static_member_data_gen_hpp.html">Header &lt;boost/tti/gen/has_static_member_data_gen.hpp&gt;</a></span></dt>
<dd><dl></dl></dd>
<dt><span class="section"><a href="header/boost/tti/gen/has_static_member_function_gen_hpp.html">Header &lt;boost/tti/gen/has_static_member_function_gen.hpp&gt;</a></span></dt>
<dd><dl></dl></dd>
<dt><span class="section"><a href="header/boost/tti/gen/has_static_member_function_template_gen_hpp.html">Header &lt;boost/tti/gen/has_static_member_function_template_gen.hpp&gt;</a></span></dt>
<dd><dl></dl></dd>
<dt><span class="section"><a href="header/boost/tti/gen/has_template_gen_hpp.html">Header &lt;boost/tti/gen/has_template_gen.hpp&gt;</a></span></dt>
<dd><dl></dl></dd>
<dt><span class="section"><a href="header/boost/tti/gen/has_type_gen_hpp.html">Header &lt;boost/tti/gen/has_type_gen.hpp&gt;</a></span></dt>
<dd><dl></dl></dd>
<dt><span class="section"><a href="header/boost/tti/gen/has_union_gen_hpp.html">Header &lt;boost/tti/gen/has_union_gen.hpp&gt;</a></span></dt>
<dd><dl></dl></dd>
<dt><span class="section"><a href="header/boost/tti/gen/member_type_gen_hpp.html">Header &lt;boost/tti/gen/member_type_gen.hpp&gt;</a></span></dt>
<dd><dl></dl></dd>
<dt><span class="section"><a href="header/boost/tti/gen/namespace_gen_hpp.html">Header &lt;boost/tti/gen/namespace_gen.hpp&gt;</a></span></dt>
<dd><dl></dl></dd>
<dt><span class="section"><a href="header/boost/tti/has_class_hpp.html">Header &lt;boost/tti/has_class.hpp&gt;</a></span></dt>
<dd><dl></dl></dd>
<dt><span class="section"><a href="header/boost/tti/has_data_hpp.html">Header &lt;boost/tti/has_data.hpp&gt;</a></span></dt>
<dd><dl></dl></dd>
<dt><span class="section"><a href="header/boost/tti/has_enum_hpp.html">Header &lt;boost/tti/has_enum.hpp&gt;</a></span></dt>
<dd><dl></dl></dd>
<dt><span class="section"><a href="header/boost/tti/has_function_hpp.html">Header &lt;boost/tti/has_function.hpp&gt;</a></span></dt>
<dd><dl></dl></dd>
<dt><span class="section"><a href="header/boost/tti/has_function_template_hpp.html">Header &lt;boost/tti/has_function_template.hpp&gt;</a></span></dt>
<dd><dl></dl></dd>
<dt><span class="section"><a href="header/boost/tti/has_member_data_hpp.html">Header &lt;boost/tti/has_member_data.hpp&gt;</a></span></dt>
<dd><dl></dl></dd>
<dt><span class="section"><a href="header/boost/tti/has_member_function_hpp.html">Header &lt;boost/tti/has_member_function.hpp&gt;</a></span></dt>
<dd><dl></dl></dd>
<dt><span class="section"><a href="header/boost/tti/has_member_function_template_hpp.html">Header &lt;boost/tti/has_member_function_template.hpp&gt;</a></span></dt>
<dd><dl></dl></dd>
<dt><span class="section"><a href="header/boost/tti/has_static_member_data_hpp.html">Header &lt;boost/tti/has_static_member_data.hpp&gt;</a></span></dt>
<dd><dl></dl></dd>
<dt><span class="section"><a href="header/boost/tti/has_static_member_function_hpp.html">Header &lt;boost/tti/has_static_member_function.hpp&gt;</a></span></dt>
<dd><dl></dl></dd>
<dt><span class="section"><a href="header/boost/tti/has_static_member_function_template_hpp.html">Header &lt;boost/tti/has_static_member_function_template.hpp&gt;</a></span></dt>
<dd><dl></dl></dd>
<dt><span class="section"><a href="header/boost/tti/has_template_hpp.html">Header &lt;boost/tti/has_template.hpp&gt;</a></span></dt>
<dd><dl></dl></dd>
<dt><span class="section"><a href="header/boost/tti/has_type_hpp.html">Header &lt;boost/tti/has_type.hpp&gt;</a></span></dt>
<dd><dl></dl></dd>
<dt><span class="section"><a href="header/boost/tti/has_union_hpp.html">Header &lt;boost/tti/has_union.hpp&gt;</a></span></dt>
<dd><dl></dl></dd>
<dt><span class="section"><a href="header/boost/tti/member_type_hpp.html">Header &lt;boost/tti/member_type.hpp&gt;</a></span></dt>
<dd><dl></dl></dd>
</dl></dd>
<dt><span class="section"><a href="the_type_traits_introspection_library/tti_tests.html">Testing
    TTI</a></span></dt>
<dt><span class="section"><a href="the_type_traits_introspection_library/tti_history.html">History</a></span></dt>
<dt><span class="section"><a href="the_type_traits_introspection_library/tti_todo.html">ToDo</a></span></dt>
<dt><span class="section"><a href="the_type_traits_introspection_library/tti_acknowledgments.html">Acknowledgments</a></span></dt>
<dt><span class="section"><a href="index/s27.html">Index</a></span></dt>
</dl>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="the_type_traits_introspection_library.tti_intro"></a><a class="link" href="index.html#the_type_traits_introspection_library.tti_intro" title="Introduction">Introduction</a>
</h2></div></div></div>
<div class="toc"><dl class="toc"><dt><span class="section"><a href="index.html#the_type_traits_introspection_library.tti_intro.tti_headers">Header
      Files</a></span></dt></dl></div>
<p>
      Welcome to the Boost Type Traits Introspection library, abbreviated TTI.
    </p>
<p>
      TTI is a library which provides the ability to introspect by name the elements
      of a type at compile time.
    </p>
<p>
      TTI works through macros generating metafunctions. Metafunctions are class
      templates of a particular syntax, having a nested 'type' member. So wherever
      in C++ class templates can occur, TTI macros can be used. The metafunctions
      generated by TTI are no different from any other metafunction as defined by
      the Boost MPL library.
    </p>
<p>
      The metafunctions generated by TTI are used to introspect elements of a type
      at compile time, always passing at minimum to each metafunction the enclosing
      type being introspected.
    </p>
<p>
      The name of the library has been chosen because the library offers compile
      time functionality on a type, similar to the Boost Type Traits library, and
      because the functionality the library offers is the ability to introspect a
      type about the existence of a specific element within that type.
    </p>
<p>
      I use the word "introspect" in a very broad sense here. Normally
      computer language introspection means initially asking for information to be
      returned by name, which can then further be used to introspect for more specific
      information. In the TTI library one must always know and supply the name, and
      use the functionality provided for the correct type of inner element to find
      out if that particular named entity exists.
    </p>
<p>
      You may prefer the term "query" instead of "introspection"
      to denote what this library does, but I use terminology based on the word "introspect"
      throughout this documentation.
    </p>
<p>
      The functionality of the library may be summed up as:
    </p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
          Provide the means to introspect a type at compile time using a set of macros.
          Each macro takes the name of the type's element and generates a metafunction
          which can be subsequently invoked to determine whether or not the element
          exists within the type. These generated metafunctions will be called "macro
          metafunctions" in the documentation. The type to be introspected can
          be a class, struct, or union.
        </li>
<li class="listitem">
          Provide the means to create a typedef for a type which may not exist. If
          the type does not exist an empty marker type is returned as the typedef
          type. This typedef type can be used as a type in the metafunctions of the
          library without producing compile-time errors.
        </li>
</ul></div>
<p>
      The library is dependent on Boost PP, Boost MPL, Boost Type Traits, and Boost
      Function Types.
    </p>
<p>
      The library is also dependent on the variadic macro support of the Boost PP
      library if the variadic macros in the library are used.
    </p>
<p>
      The library is a header only library.
    </p>
<p>
      Since the dependencies of the library are all header only libraries, there
      is no need to build a library in order to use the TTI library.
    </p>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="the_type_traits_introspection_library.tti_intro.tti_headers"></a><a class="link" href="index.html#the_type_traits_introspection_library.tti_intro.tti_headers" title="Header Files">Header
      Files</a>
</h3></div></div></div>
<p>
        There is a single header file, <code class="computeroutput"><span class="identifier">boost</span><span class="special">/</span><span class="identifier">tti</span><span class="special">/</span><span class="identifier">tti</span><span class="special">.</span><span class="identifier">hpp</span></code>,
        which includes all the header files in the library.
      </p>
<p>
        There are also separate specific header files for each of the elements to
        be introspected by the library. This allows for finer-grained inclusion of
        the nested elements to be introspected. These header files are:
      </p>
<div class="table">
<a name="the_type_traits_introspection_library.tti_intro.tti_headers.tbhfiles"></a><p class="title"><b>Table 1.1. TTI Header Files</b></p>
<div class="table-contents"><table class="table" summary="TTI Header Files">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
                <p>
                  Introspected Element
                </p>
              </th>
<th>
                <p>
                  Specific Header File
                </p>
              </th>
</tr></thead>
<tbody>
<tr>
<td>
                <p>
                  Type
                </p>
              </td>
<td>
                <p>
                  <code class="computeroutput"><a class="link" href="header/boost/tti/has_type_hpp.html" title="Header &lt;boost/tti/has_type.hpp&gt;">has_type.hpp</a></code>
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  Class/Struct
                </p>
              </td>
<td>
                <p>
                  <code class="computeroutput"><a class="link" href="header/boost/tti/has_class_hpp.html" title="Header &lt;boost/tti/has_class.hpp&gt;">has_class.hpp</a></code>
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  Enumeration
                </p>
              </td>
<td>
                <p>
                  <code class="computeroutput"><a class="link" href="header/boost/tti/has_enum_hpp.html" title="Header &lt;boost/tti/has_enum.hpp&gt;">has_enum.hpp</a></code>
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  Union
                </p>
              </td>
<td>
                <p>
                  <code class="computeroutput"><a class="link" href="header/boost/tti/has_union_hpp.html" title="Header &lt;boost/tti/has_union.hpp&gt;">has_union.hpp</a></code>
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  Class Template
                </p>
              </td>
<td>
                <p>
                  <code class="computeroutput"><a class="link" href="header/boost/tti/has_template_hpp.html" title="Header &lt;boost/tti/has_template.hpp&gt;">has_template.hpp</a></code>
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  Member data
                </p>
              </td>
<td>
                <p>
                  <code class="computeroutput"><a class="link" href="header/boost/tti/has_member_data_hpp.html" title="Header &lt;boost/tti/has_member_data.hpp&gt;">has_member_data.hpp</a></code>
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  Member function
                </p>
              </td>
<td>
                <p>
                  <code class="computeroutput"><a class="link" href="header/boost/tti/has_member_function_hpp.html" title="Header &lt;boost/tti/has_member_function.hpp&gt;">has_member_function.hpp</a></code>
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  Member function template
                </p>
              </td>
<td>
                <p>
                  <code class="computeroutput"><a class="link" href="header/boost/tti/has_member_function_template_hpp.html" title="Header &lt;boost/tti/has_member_function_template.hpp&gt;">has_member_function_template.hpp</a></code>
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  Static member data
                </p>
              </td>
<td>
                <p>
                  <code class="computeroutput"><a class="link" href="header/boost/tti/has_static_member_data_hpp.html" title="Header &lt;boost/tti/has_static_member_data.hpp&gt;">has_static_member_data.hpp</a></code>
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  Static member function
                </p>
              </td>
<td>
                <p>
                  <code class="computeroutput"><a class="link" href="header/boost/tti/has_static_member_function_hpp.html" title="Header &lt;boost/tti/has_static_member_function.hpp&gt;">has_static_member_function.hpp</a></code>
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  Static member function template
                </p>
              </td>
<td>
                <p>
                  <code class="computeroutput"><a class="link" href="header/boost/tti/has_static_member_function_template_hpp.html" title="Header &lt;boost/tti/has_static_member_function_template.hpp&gt;">has_static_member_function_template.hpp</a></code>
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  Data
                </p>
              </td>
<td>
                <p>
                  <code class="computeroutput"><a class="link" href="header/boost/tti/has_data_hpp.html" title="Header &lt;boost/tti/has_data.hpp&gt;">has_data.hpp</a></code>
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  Function
                </p>
              </td>
<td>
                <p>
                  <code class="computeroutput"><a class="link" href="header/boost/tti/has_function_hpp.html" title="Header &lt;boost/tti/has_function.hpp&gt;">has_function.hpp</a></code>
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  Function template
                </p>
              </td>
<td>
                <p>
                  <code class="computeroutput"><a class="link" href="header/boost/tti/has_function_template_hpp.html" title="Header &lt;boost/tti/has_function_template.hpp&gt;">has_function_template.hpp</a></code>
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  Member Type Creation
                </p>
              </td>
<td>
                <p>
                  <code class="computeroutput"><a class="link" href="header/boost/tti/member_type_hpp.html" title="Header &lt;boost/tti/member_type.hpp&gt;">member_type.hpp</a></code>
                </p>
              </td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break">
</div>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"><p><small>Last revised: April 06, 2022 at 21:04:29 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td>
</tr></table>
<hr>
<div class="spirit-nav"><a accesskey="n" href="the_type_traits_introspection_library/tti_reason.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a></div>
</body>
</html>
